﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Terrain : MonoBehaviour {

	// Use this for initialization
	void Start () {
        
        GridManager.GetInstance().SetMapSize(500);
        int nBaseX = 100;
        int nBaseY = 100;
        int temp;
        string testModel = "blueWall";
        for(int i = 0; i < 256; i++)
        {
            int nPosX = nBaseX+(i%16)*4;
            int nPosY = nBaseY+(i/16)*4;
            temp = (i&0x01);    if(temp != 0) GridManager.GetInstance().AddBuilding(ObjType.eot_Wall, testModel, nPosX-1, nPosY-1);
            temp = (i&0x02);    if(temp != 0) GridManager.GetInstance().AddBuilding(ObjType.eot_Wall, testModel, nPosX, nPosY-1);
            temp = (i&0x04);    if(temp != 0) GridManager.GetInstance().AddBuilding(ObjType.eot_Wall, testModel, nPosX+1, nPosY-1);

            temp = (i&0x08);    if(temp != 0) GridManager.GetInstance().AddBuilding(ObjType.eot_Wall, testModel, nPosX-1, nPosY);
            GridManager.GetInstance().AddBuilding(ObjType.eot_Wall, testModel, nPosX, nPosY);
            temp = (i&0x10);    if(temp != 0) GridManager.GetInstance().AddBuilding(ObjType.eot_Wall, testModel, nPosX+1, nPosY);

            temp = (i&0x20);    if(temp != 0) GridManager.GetInstance().AddBuilding(ObjType.eot_Wall, testModel, nPosX-1, nPosY+1);
            temp = (i&0x40);    if(temp != 0) GridManager.GetInstance().AddBuilding(ObjType.eot_Wall, testModel, nPosX, nPosY+1);
            temp = (i&0x80);    if(temp != 0) GridManager.GetInstance().AddBuilding(ObjType.eot_Wall, testModel, nPosX+1, nPosY+1);
        }
	}
	
	// Update is called once per frame
	void Update () {
		
	}
}
